package models

import (
	"fmt"
	"github.com/goravel/framework/database/orm"
	"gorm.io/datatypes"
	"gorm.io/gorm"
	"time"
)

type ShortVideo struct {
	orm.Model
	Source          string         `json:"source"`
	SourceId        string         `json:"source_id"`
	CategoryId      int64          `json:"category_id"`
	Title           string         `json:"title"`
	Cover           string         `json:"cover"`
	Remark          string         `json:"remark"`
	Author          string         `json:"author"`
	Duration        int            `json:"duration"`
	PlayUrl         string         `json:"play_url"`
	Tags            datatypes.JSON `json:"tags" gorm:"type:text"`
	SellingPoints   string         `json:"selling_points"`
	IsVertical      int            `json:"is_vertical"`
	Status          int            `json:"status"`
	IncomingTime    time.Time      `json:"incoming_time"`
	ShowTime        time.Time      `json:"show_time"`
	CopyrightExpiry time.Time      `json:"copyright_expiry"`
}

func NewShortVideo() *ShortVideo {
	return &ShortVideo{}
}

func (m *ShortVideo) TableName() string {
	return "short_video"
}

func (m *ShortVideo) BeforeCreate(c *gorm.DB) (err error) {
	fmt.Println("ShortVideo BeforeCreate")
	return
}
